home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!snorkelwacker.mit.edu!usc!cs.utexas.edu!sun-barr!newstop!exodus!Snoqualmie.hisoft.infocomm.com
- From: jimmc@Snoqualmie.hisoft.infocomm.com (Jim McBeath)
- Newsgroups: comp.sources.x
- Subject: v10i093: xmines, Patch1, Part01/01
- Message-ID: <4808@exodus.Eng.Sun.COM>
- Date: 19 Dec 90 02:35:50 GMT
- References: <csx-10i093:xmines@uunet.UU.NET>
- Sender: news@exodus.Eng.Sun.COM
- Lines: 319
- Approved: argv@sun.com
-
- Submitted-by: jimmc@Snoqualmie.hisoft.infocomm.com (Jim McBeath)
- Posting-number: Volume 10, Issue 93
- Archive-name: xmines/patch1
- Patch-To: xmines: Volume 9, Issue 27-29
-
- #! /bin/sh
- ## This is a shell archive. Remove anything before this line, then unpack
- ## it by saving it into a file and typing "sh file". To overwrite existing
- ## files, type "sh file -c". You can also feed this as standard input via
- ## unshar, or by typing "sh <file". If this archive is complete, you will
- ## see the following message at the end:
- # "End of shell archive."
- # Contents: patchlevel.h.diff History.diff board.c.diff draw.c.diff
- # main.c.diff
- # Wrapped by jimmc@snoqualmie on Mon Dec 10 14:42:23 1990
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f patchlevel.h.diff -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"patchlevel.h.diff\"
- else
- echo shar: Extracting \"patchlevel.h.diff\" \(704 characters\)
- sed "s/^X//" >patchlevel.h.diff <<'END_OF_patchlevel.h.diff'
- X*** V1.1/patchlevel.h Thu Nov 29 10:24:50 1990
- X--- patchlevel.h Thu Nov 29 11:21:40 1990
- X***************
- X*** 27,36 ****
- X /* patchlevel.h for xmines
- X */
- X
- X! char *MinesVersion = "XMines v1.1";
- X
- X! /*
- X! * Current patchlevel is 0 - this is the original!
- X */
- X
- X /* end */
- X--- 27,40 ----
- X /* patchlevel.h for xmines
- X */
- X
- X! char *MinesVersion = "XMines v1.2";
- X
- X! /* patch 1, xmines v1.2:
- X! * 1. remove #include <strings.h> from board.c (included from Intrinsic.h)
- X! * 2. use unsigned int for window width and height in draw.c
- X! * 3. add icon hint (main.c)
- X! * 4. add srandom call, "seed" resource (main.c)
- X! * 5. fix wrong nearby-bomb count in final square (board.c)
- X */
- X
- X /* end */
- END_OF_patchlevel.h.diff
- if test 704 -ne `wc -c <patchlevel.h.diff`; then
- echo shar: \"patchlevel.h.diff\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f History.diff -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"History.diff\"
- else
- echo shar: Extracting \"History.diff\" \(1102 characters\)
- sed "s/^X//" >History.diff <<'END_OF_History.diff'
- X*** V1.1/History Thu Nov 29 10:24:47 1990
- X--- History Mon Dec 10 14:23:02 1990
- X***************
- X*** 1,4 ****
- X! XMines History 22-Aug-90
- X
- X The Mines game was originally written by Tom Anderson of Fluke Manufacturing.
- X It was written for suntools, and was based on his chess tool (as Tom said
- X--- 1,4 ----
- X! XMines History 10-Dec-90
- X
- X The Mines game was originally written by Tom Anderson of Fluke Manufacturing.
- X It was written for suntools, and was based on his chess tool (as Tom said
- X***************
- X*** 36,41 ****
- X--- 36,43 ----
- X by Jim McBeath in January 1990. Various cleanup, writing of man pages, etc.,
- X happened (at low priority) over the next few months until it was posted.
- X
- X+ Xmines was posted to comp.sources.x in September 1990.
- X+ Patch 1 was posted in December 1990.
- X
- X Authors:
- X
- X***************
- X*** 50,54 ****
- X
- X Jim McBeath
- X Globetrotter Software, Inc.
- X! (408)741-0489
- X! globes!jimmc@oliveb.olivetti.com
- X--- 52,56 ----
- X
- X Jim McBeath
- X Globetrotter Software, Inc.
- X! (415)493-8567x221 (Highland Software)
- X! jimmc@hisoft.uucp (alternate: jimmc@netcom.uucp)
- END_OF_History.diff
- if test 1102 -ne `wc -c <History.diff`; then
- echo shar: \"History.diff\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f board.c.diff -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"board.c.diff\"
- else
- echo shar: Extracting \"board.c.diff\" \(1017 characters\)
- sed "s/^X//" >board.c.diff <<'END_OF_board.c.diff'
- X*** V1.1/board.c Thu Nov 29 10:24:50 1990
- X--- board.c Thu Nov 29 11:05:18 1990
- X***************
- X*** 29,35 ****
- X static char copyright[] = "Copyright 1987 Tom Anderson";
- X
- X #include <stdio.h>
- X- #include <strings.h>
- X #include <sys/types.h>
- X
- X #include <X11/Intrinsic.h>
- X--- 29,34 ----
- X***************
- X*** 300,305 ****
- X--- 299,305 ----
- X /* else if this is home, render congratulations */
- X else if (col == BoardCols-1 && row == BoardRows-1) {
- X PlayerSquare = sqp;
- X+ (void)MineWarningMessage(); /* fix up nearby count */
- X sqp->traversed = sqp->occupied = TRUE;
- X GameOver = TRUE;
- X Message("You honestly made it!");
- X***************
- X*** 343,350 ****
- X #ifndef NOSCORE
- X IncrHints(1);
- X #endif
- X! MainBoard[j][i].safe = TRUE;
- X! MainBoard[j][i].unsafe = FALSE;
- X
- X return (GetSquare(j,i));
- X }
- X--- 343,350 ----
- X #ifndef NOSCORE
- X IncrHints(1);
- X #endif
- X! MarkSquare(&MainBoard[j][i],1);
- X! /* mark as safe, keep track of counts */
- X
- X return (GetSquare(j,i));
- X }
- END_OF_board.c.diff
- if test 1017 -ne `wc -c <board.c.diff`; then
- echo shar: \"board.c.diff\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f draw.c.diff -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"draw.c.diff\"
- else
- echo shar: Extracting \"draw.c.diff\" \(941 characters\)
- sed "s/^X//" >draw.c.diff <<'END_OF_draw.c.diff'
- X*** V1.1/draw.c Thu Nov 29 10:24:51 1990
- X--- draw.c Thu Sep 13 10:41:21 1990
- X***************
- X*** 166,172 ****
- X Window win;
- X Display *dpy;
- X GC gc;
- X! int width,height,bmsize;
- X int dx,dy;
- X int i;
- X Arg args[10];
- X--- 166,173 ----
- X Window win;
- X Display *dpy;
- X GC gc;
- X! unsigned int width, height;
- X! int bmsize;
- X int dx,dy;
- X int i;
- X Arg args[10];
- X***************
- X*** 244,250 ****
- X /* a hack to avoid getting the size for every cell */
- X if (sqp->row==0 && sqp->col==0) {
- X Window root;
- X! int x,y,bwidth,depth;
- X XGetGeometry(dpy,win,&root,&x,&y,&width,&height,&bwidth,&depth);
- X lastwidth = width;
- X lastheight = height;
- X--- 245,252 ----
- X /* a hack to avoid getting the size for every cell */
- X if (sqp->row==0 && sqp->col==0) {
- X Window root;
- X! int x,y;
- X! unsigned int bwidth,depth;
- X XGetGeometry(dpy,win,&root,&x,&y,&width,&height,&bwidth,&depth);
- X lastwidth = width;
- X lastheight = height;
- END_OF_draw.c.diff
- if test 941 -ne `wc -c <draw.c.diff`; then
- echo shar: \"draw.c.diff\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f main.c.diff -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"main.c.diff\"
- else
- echo shar: Extracting \"main.c.diff\" \(2876 characters\)
- sed "s/^X//" >main.c.diff <<'END_OF_main.c.diff'
- X*** V1.1/main.c Thu Nov 29 10:24:52 1990
- X--- main.c Thu Nov 29 11:17:05 1990
- X***************
- X*** 34,39 ****
- X--- 34,40 ----
- X #include <stdio.h>
- X #include <ctype.h>
- X #include "mines.h"
- X+ #include "mine.xbm"
- X #include "patchlevel.h" /* pick up the version string */
- X
- X char *Progname;
- X***************
- X*** 46,55 ****
- X int cellsize; /* width and height of each cell in the array */
- X int numrows, numcols;
- X int minecount;
- X } AppResources, *AppResourcesPtr;
- X
- X /* a place to put data into from the call to XtGetApplicationResources. */
- X! static AppResources Adata = { 32, DEFAULT_BOARD_ROWS, DEFAULT_BOARD_COLS};
- X
- X /* fallback resources in case we can't find the app-defaults file */
- X static String fallback_resources[] = {
- X--- 47,57 ----
- X int cellsize; /* width and height of each cell in the array */
- X int numrows, numcols;
- X int minecount;
- X+ int seed; /* srandom seed; 0 means use time of day */
- X } AppResources, *AppResourcesPtr;
- X
- X /* a place to put data into from the call to XtGetApplicationResources. */
- X! static AppResources Adata = { 32, DEFAULT_BOARD_ROWS, DEFAULT_BOARD_COLS, 0};
- X
- X /* fallback resources in case we can't find the app-defaults file */
- X static String fallback_resources[] = {
- X***************
- X*** 76,81 ****
- X--- 78,84 ----
- X {"-rows", "rows", XrmoptionSepArg, NULL },
- X {"-columns", "columns", XrmoptionSepArg, NULL },
- X {"-mines", "mines", XrmoptionSepArg, NULL },
- X+ {"-seed", "seed", XrmoptionSepArg, NULL },
- X };
- X
- X /* resource items that can be specified in the users resources database
- X***************
- X*** 90,95 ****
- X--- 93,100 ----
- X XtOffset(AppResourcesPtr,numcols), XtRInt, (char *)0},
- X {"mines", "Mines", XtRInt, sizeof(int),
- X XtOffset(AppResourcesPtr,minecount), XtRInt, (char *)0},
- X+ {"seed", "Seed", XtRInt, sizeof(int),
- X+ XtOffset(AppResourcesPtr,seed), XtRInt, (char *)0},
- X };
- X
- X
- X***************
- X*** 111,116 ****
- X--- 116,123 ----
- X int i,n;
- X Display *dpy;
- X XrmDatabase rmdb;
- X+ XWMHints Hints;
- X+ long t;
- X
- X Progname = rindex(argv[0],'/');
- X if (Progname) Progname++;
- X***************
- X*** 152,163 ****
- X--- 159,182 ----
- X Adata.numrows = DEFAULT_BOARD_ROWS;
- X if (Adata.numcols==0)
- X Adata.numcols = DEFAULT_BOARD_COLS;
- X+ if (Adata.seed==0) {
- X+ time(&t);
- X+ Adata.seed = t;
- X+ }
- X
- X AllocBoard(Adata.numrows,Adata.numcols,Adata.minecount);
- X
- X makeform(top,Adata.numrows,Adata.numcols,Adata.cellsize);
- X XtRealizeWidget(top);
- X+
- X+ /* icon suggestion from Marty Ryba <marty@puppsr.Princeton.EDU> */
- X+ Hints.icon_pixmap = XCreateBitmapFromData(dpy, DefaultRootWindow(dpy),
- X+ mine_bits, mine_width, mine_height);
- X+ Hints.flags = IconPixmapHint;
- X+ XSetWMHints(dpy, XtWindow(top), &Hints);
- X+
- X InitBitmaps(dpy,XtWindow(top));
- X+ srandom(Adata.seed); /* swizzle the random number generator */
- X InitBoard(0);
- X XtAppMainLoop(appctx);
- X /* NOTREACHED */
- END_OF_main.c.diff
- if test 2876 -ne `wc -c <main.c.diff`; then
- echo shar: \"main.c.diff\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- echo shar: End of shell archive.
- exit 0
-
- --
- dan
- ----------------------------------------------------
- O'Reilly && Associates argv@sun.com / argv@ora.com
- Opinions expressed reflect those of the author only.
-